3.2.67 \(\int \frac {(c+d \sec (e+f x))^2}{\sqrt {a+a \sec (e+f x)}} \, dx\) [167]

Optimal. Leaf size=183 \[ \frac {2 d^2 \tan (e+f x)}{f \sqrt {a+a \sec (e+f x)}}+\frac {2 \sqrt {a} c^2 \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {a}}\right ) \tan (e+f x)}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}-\frac {\sqrt {2} \sqrt {a} (c-d)^2 \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {2} \sqrt {a}}\right ) \tan (e+f x)}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \]

[Out]

2*d^2*tan(f*x+e)/f/(a+a*sec(f*x+e))^(1/2)+2*c^2*arctanh((a-a*sec(f*x+e))^(1/2)/a^(1/2))*a^(1/2)*tan(f*x+e)/f/(
a-a*sec(f*x+e))^(1/2)/(a+a*sec(f*x+e))^(1/2)-(c-d)^2*arctanh(1/2*(a-a*sec(f*x+e))^(1/2)*2^(1/2)/a^(1/2))*2^(1/
2)*a^(1/2)*tan(f*x+e)/f/(a-a*sec(f*x+e))^(1/2)/(a+a*sec(f*x+e))^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 183, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.148, Rules used = {4025, 186, 65, 212} \begin {gather*} \frac {2 \sqrt {a} c^2 \tan (e+f x) \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {a}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}-\frac {\sqrt {2} \sqrt {a} (c-d)^2 \tan (e+f x) \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {2} \sqrt {a}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}+\frac {2 d^2 \tan (e+f x)}{f \sqrt {a \sec (e+f x)+a}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*Sec[e + f*x])^2/Sqrt[a + a*Sec[e + f*x]],x]

[Out]

(2*d^2*Tan[e + f*x])/(f*Sqrt[a + a*Sec[e + f*x]]) + (2*Sqrt[a]*c^2*ArcTanh[Sqrt[a - a*Sec[e + f*x]]/Sqrt[a]]*T
an[e + f*x])/(f*Sqrt[a - a*Sec[e + f*x]]*Sqrt[a + a*Sec[e + f*x]]) - (Sqrt[2]*Sqrt[a]*(c - d)^2*ArcTanh[Sqrt[a
 - a*Sec[e + f*x]]/(Sqrt[2]*Sqrt[a])]*Tan[e + f*x])/(f*Sqrt[a - a*Sec[e + f*x]]*Sqrt[a + a*Sec[e + f*x]])

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 186

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_))^(q_), x
_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p*(g + h*x)^q, x], x] /; FreeQ[{a, b, c, d,
e, f, g, h, m, n}, x] && IntegersQ[p, q]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 4025

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.), x_Symbol] :> Di
st[a^2*(Cot[e + f*x]/(f*Sqrt[a + b*Csc[e + f*x]]*Sqrt[a - b*Csc[e + f*x]])), Subst[Int[(a + b*x)^(m - 1/2)*((c
 + d*x)^n/(x*Sqrt[a - b*x])), x], x, Csc[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && NeQ[b*c - a*d,
 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && IntegerQ[m - 1/2]

Rubi steps

\begin {align*} \int \frac {(c+d \sec (e+f x))^2}{\sqrt {a+a \sec (e+f x)}} \, dx &=-\frac {\left (a^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {(c+d x)^2}{x \sqrt {a-a x} (a+a x)} \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}\\ &=-\frac {\left (a^2 \tan (e+f x)\right ) \text {Subst}\left (\int \left (\frac {d^2}{a \sqrt {a-a x}}+\frac {c^2}{a x \sqrt {a-a x}}-\frac {(c-d)^2}{a (1+x) \sqrt {a-a x}}\right ) \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}\\ &=\frac {2 d^2 \tan (e+f x)}{f \sqrt {a+a \sec (e+f x)}}-\frac {\left (a c^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{x \sqrt {a-a x}} \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}+\frac {\left (a (c-d)^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{(1+x) \sqrt {a-a x}} \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}\\ &=\frac {2 d^2 \tan (e+f x)}{f \sqrt {a+a \sec (e+f x)}}+\frac {\left (2 c^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{1-\frac {x^2}{a}} \, dx,x,\sqrt {a-a \sec (e+f x)}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}-\frac {\left (2 (c-d)^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{2-\frac {x^2}{a}} \, dx,x,\sqrt {a-a \sec (e+f x)}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}\\ &=\frac {2 d^2 \tan (e+f x)}{f \sqrt {a+a \sec (e+f x)}}+\frac {2 \sqrt {a} c^2 \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {a}}\right ) \tan (e+f x)}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}-\frac {\sqrt {2} \sqrt {a} (c-d)^2 \tanh ^{-1}\left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {2} \sqrt {a}}\right ) \tan (e+f x)}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.
time = 2.56, size = 295, normalized size = 1.61 \begin {gather*} \frac {2 \cos \left (\frac {1}{2} (e+f x)\right ) \cos ^{\frac {3}{2}}(e+f x) (c+d \sec (e+f x))^2 \left (-\frac {(c-d)^2 \sqrt {-1+\cos (e+f x)} (2+\cos (e+f x)) \csc ^3\left (\frac {1}{2} (e+f x)\right ) \left (-2 \tanh ^{-1}\left (\sqrt {-\sec (e+f x) \sin ^2\left (\frac {1}{2} (e+f x)\right )}\right )+\sqrt {2-2 \sec (e+f x)}\right )}{2 \sqrt {2}}+\frac {4 c d \sin \left (\frac {1}{2} (e+f x)\right )}{\sqrt {\cos (e+f x)}}+c^2 \left (\sqrt {2} \text {ArcSin}\left (\sqrt {2} \sin \left (\frac {1}{2} (e+f x)\right )\right )-\frac {2 \sin \left (\frac {1}{2} (e+f x)\right )}{\sqrt {\cos (e+f x)}}\right )-\frac {(c-d)^2 \, _2F_1\left (2,\frac {5}{2};\frac {7}{2};-\sec (e+f x) \sin ^2\left (\frac {1}{2} (e+f x)\right )\right ) \sin \left (\frac {1}{2} (e+f x)\right ) \sin ^2(e+f x)}{10 \cos ^{\frac {5}{2}}(e+f x)}\right )}{f (d+c \cos (e+f x))^2 \sqrt {a (1+\sec (e+f x))}} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[(c + d*Sec[e + f*x])^2/Sqrt[a + a*Sec[e + f*x]],x]

[Out]

(2*Cos[(e + f*x)/2]*Cos[e + f*x]^(3/2)*(c + d*Sec[e + f*x])^2*(-1/2*((c - d)^2*Sqrt[-1 + Cos[e + f*x]]*(2 + Co
s[e + f*x])*Csc[(e + f*x)/2]^3*(-2*ArcTanh[Sqrt[-(Sec[e + f*x]*Sin[(e + f*x)/2]^2)]] + Sqrt[2 - 2*Sec[e + f*x]
]))/Sqrt[2] + (4*c*d*Sin[(e + f*x)/2])/Sqrt[Cos[e + f*x]] + c^2*(Sqrt[2]*ArcSin[Sqrt[2]*Sin[(e + f*x)/2]] - (2
*Sin[(e + f*x)/2])/Sqrt[Cos[e + f*x]]) - ((c - d)^2*Hypergeometric2F1[2, 5/2, 7/2, -(Sec[e + f*x]*Sin[(e + f*x
)/2]^2)]*Sin[(e + f*x)/2]*Sin[e + f*x]^2)/(10*Cos[e + f*x]^(5/2))))/(f*(d + c*Cos[e + f*x])^2*Sqrt[a*(1 + Sec[
e + f*x])])

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(357\) vs. \(2(158)=316\).
time = 1.51, size = 358, normalized size = 1.96

method result size
default \(-\frac {\sqrt {\frac {a \left (\cos \left (f x +e \right )+1\right )}{\cos \left (f x +e \right )}}\, \left (\sqrt {2}\, \sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \arctanh \left (\frac {\sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \sin \left (f x +e \right ) \sqrt {2}}{2 \cos \left (f x +e \right )}\right ) c^{2} \sin \left (f x +e \right )+\sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \ln \left (\frac {\sin \left (f x +e \right ) \sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}-\cos \left (f x +e \right )+1}{\sin \left (f x +e \right )}\right ) c^{2} \sin \left (f x +e \right )-2 \sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \ln \left (\frac {\sin \left (f x +e \right ) \sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}-\cos \left (f x +e \right )+1}{\sin \left (f x +e \right )}\right ) c d \sin \left (f x +e \right )+\sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \ln \left (\frac {\sin \left (f x +e \right ) \sqrt {-\frac {2 \cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}-\cos \left (f x +e \right )+1}{\sin \left (f x +e \right )}\right ) d^{2} \sin \left (f x +e \right )+2 \cos \left (f x +e \right ) d^{2}-2 d^{2}\right )}{f \sin \left (f x +e \right ) a}\) \(358\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*sec(f*x+e))^2/(a+a*sec(f*x+e))^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/f*(a*(cos(f*x+e)+1)/cos(f*x+e))^(1/2)*(2^(1/2)*(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)*arctanh(1/2*(-2*cos(f*x
+e)/(cos(f*x+e)+1))^(1/2)*sin(f*x+e)/cos(f*x+e)*2^(1/2))*c^2*sin(f*x+e)+(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)*l
n((sin(f*x+e)*(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)-cos(f*x+e)+1)/sin(f*x+e))*c^2*sin(f*x+e)-2*(-2*cos(f*x+e)/(
cos(f*x+e)+1))^(1/2)*ln((sin(f*x+e)*(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)-cos(f*x+e)+1)/sin(f*x+e))*c*d*sin(f*x
+e)+(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)*ln((sin(f*x+e)*(-2*cos(f*x+e)/(cos(f*x+e)+1))^(1/2)-cos(f*x+e)+1)/sin
(f*x+e))*d^2*sin(f*x+e)+2*cos(f*x+e)*d^2-2*d^2)/sin(f*x+e)/a

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^2/(a+a*sec(f*x+e))^(1/2),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: sign: argument cannot be imaginary
; found %i

________________________________________________________________________________________

Fricas [A]
time = 7.48, size = 516, normalized size = 2.82 \begin {gather*} \left [\frac {4 \, d^{2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \sin \left (f x + e\right ) + \sqrt {2} {\left (a c^{2} - 2 \, a c d + a d^{2} + {\left (a c^{2} - 2 \, a c d + a d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt {-\frac {1}{a}} \log \left (\frac {2 \, \sqrt {2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \sqrt {-\frac {1}{a}} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + 3 \, \cos \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) + 1}\right ) - 2 \, {\left (c^{2} \cos \left (f x + e\right ) + c^{2}\right )} \sqrt {-a} \log \left (\frac {2 \, a \cos \left (f x + e\right )^{2} + 2 \, \sqrt {-a} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + a \cos \left (f x + e\right ) - a}{\cos \left (f x + e\right ) + 1}\right )}{2 \, {\left (a f \cos \left (f x + e\right ) + a f\right )}}, \frac {2 \, d^{2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \sin \left (f x + e\right ) - 2 \, {\left (c^{2} \cos \left (f x + e\right ) + c^{2}\right )} \sqrt {a} \arctan \left (\frac {\sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right )}{\sqrt {a} \sin \left (f x + e\right )}\right ) + \frac {\sqrt {2} {\left (a c^{2} - 2 \, a c d + a d^{2} + {\left (a c^{2} - 2 \, a c d + a d^{2}\right )} \cos \left (f x + e\right )\right )} \arctan \left (\frac {\sqrt {2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right )}{\sqrt {a} \sin \left (f x + e\right )}\right )}{\sqrt {a}}}{a f \cos \left (f x + e\right ) + a f}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^2/(a+a*sec(f*x+e))^(1/2),x, algorithm="fricas")

[Out]

[1/2*(4*d^2*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*sin(f*x + e) + sqrt(2)*(a*c^2 - 2*a*c*d + a*d^2 + (a*c^2 -
 2*a*c*d + a*d^2)*cos(f*x + e))*sqrt(-1/a)*log((2*sqrt(2)*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*sqrt(-1/a)*c
os(f*x + e)*sin(f*x + e) + 3*cos(f*x + e)^2 + 2*cos(f*x + e) - 1)/(cos(f*x + e)^2 + 2*cos(f*x + e) + 1)) - 2*(
c^2*cos(f*x + e) + c^2)*sqrt(-a)*log((2*a*cos(f*x + e)^2 + 2*sqrt(-a)*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*
cos(f*x + e)*sin(f*x + e) + a*cos(f*x + e) - a)/(cos(f*x + e) + 1)))/(a*f*cos(f*x + e) + a*f), (2*d^2*sqrt((a*
cos(f*x + e) + a)/cos(f*x + e))*sin(f*x + e) - 2*(c^2*cos(f*x + e) + c^2)*sqrt(a)*arctan(sqrt((a*cos(f*x + e)
+ a)/cos(f*x + e))*cos(f*x + e)/(sqrt(a)*sin(f*x + e))) + sqrt(2)*(a*c^2 - 2*a*c*d + a*d^2 + (a*c^2 - 2*a*c*d
+ a*d^2)*cos(f*x + e))*arctan(sqrt(2)*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*cos(f*x + e)/(sqrt(a)*sin(f*x +
e)))/sqrt(a))/(a*f*cos(f*x + e) + a*f)]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (c + d \sec {\left (e + f x \right )}\right )^{2}}{\sqrt {a \left (\sec {\left (e + f x \right )} + 1\right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))**2/(a+a*sec(f*x+e))**(1/2),x)

[Out]

Integral((c + d*sec(e + f*x))**2/sqrt(a*(sec(e + f*x) + 1)), x)

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^2/(a+a*sec(f*x+e))^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> An error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):Ch
eck [abs(co

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (c+\frac {d}{\cos \left (e+f\,x\right )}\right )}^2}{\sqrt {a+\frac {a}{\cos \left (e+f\,x\right )}}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d/cos(e + f*x))^2/(a + a/cos(e + f*x))^(1/2),x)

[Out]

int((c + d/cos(e + f*x))^2/(a + a/cos(e + f*x))^(1/2), x)

________________________________________________________________________________________